package domain.gbshaasrode.spreadsheet;

import com.google.gdata.client.spreadsheet.SpreadsheetService;
import com.google.gdata.util.AuthenticationException;

import domain.DomainException;

public class GBSHaasrodeSpreadSheetService {
	
	public final static String USERNAME = "opvangGBSHaasrode@gmail.com";
	public final static String PASSWORD = "OpvangApp2013";
	
	private SpreadsheetService service;
		
	public GBSHaasrodeSpreadSheetService() throws DomainException{
		
		try {
			SpreadsheetService service =
					new SpreadsheetService("MySpreadsheetIntegration-v1");
			service.setUserCredentials(USERNAME, PASSWORD);
			setService(service);
		} catch(AuthenticationException e) {
			throw new DomainException("Cannot authenticate",e);
		}
	}

	public SpreadsheetService getService() {
		return service;
	}

	private void setService(SpreadsheetService service) {
		this.service = service;
	}

}
